#!/bin/bash

jar_name=$(ls -1 -F -r *.jar | awk '{printf("%04d %s\n",length($0), $0)}' | sort -r -n | head -1 | awk '{print $2}')

java -Xms1250m -Xmx1250m -XX:MaxMetaspaceSize=178m -XX:MetaspaceSize=178m -Xss512k ${JAVA_OPTS} \
 -Dlog4j2.formatMsgNoLookups=true \
 -Dspring.cloud.bootstrap.enabled=true \
 -Dreactor.netty.pool.leasingStrategy=lifo \
 ${JAVA_SKYWLKING_OPT} \
 -Dloader.path=lib \
 -jar $jar_name \
 --spring.main.allow-bean-definition-overriding=true \
 --spring.main.allow-circular-references=true \
 --spring.application.name=${APP_NAME} \
 --spring.profiles.active=${PROFILE} \
 --server.port=80 \
 --app.group=${APP_GROUP} \
 ${JAVA_ARGS}